// 针对IE下 resize 事件假死的fix
$.fn.wresize = function (f) {
    version = '1.1';
    wresize = { fired: false, _lastWidth: 0, _lastHeight: 0 };
    timeout = 50;

    function handleWResize(e) {
        if ($.browser.msie) {
            if (!wresize.fired) {
                setTimeout(function () {
                    wresize.fired = false;
                }, timeout);

                // 触发resize后，只有widht和height真正发生改变才触发事件
                if (wresize._lastWidth != $(window).width() || wresize._lastHeight != $(window).height()) {
                    wresize.fired = true;
                    wresize._lastWidth = $(window).width();
                    wresize._lastHeight = $(window).height();

                    return f.apply(this, [e]);
                }

            }
        } else {
            // 非IE浏览器直接触发事件
            return f.apply(this, [e]);
        }
        return false;
    }

    this.each(function () {
        if (this == window) {
            $(this).resize(handleWResize);
        }
        else {
            $(this).resize(f);
        }
    });

    return this;
};